package com.xinsoft.entity.dto;

import cn.hutool.core.util.ObjectUtil;
import com.xinsoft.entity.po.SysSupplier;
import com.xinsoft.utils.TokenUtil;
import lombok.Data;

/**
 *  @author: π
 *  供应商
 */
@Data
public class KisSupplierDto {

    private String FItemId;
    private String FNumber;
    private String FName;
    private String FHelpCode;
    private String FShortName;
    private String FAddress;
    private String FStatus;
    private String FStatus_FName;
    private String FContact;
    private String FPhone;
    private String FMobilePhone;
    private String FFax;
    private String FEmail;
    private String FBank;
    private String FAccount;
    private String Fcorperate;
    private String FDiscount;
    private String FTypeID;
    private String FTypeID_FName;

//              kis字段 ：
//                    "FItemId":"内码"
//                    "FNumber":"编码"
//                    "FName":"名称"
//                    "FHelpCode":"助记码"
//                    "FShortName":"简称"
//                    "FAddress":"地址"
//                    "FStatus":"状态"
//                    "FStatus_FName":"状态"
//                    "FContact":"联系人"
//                    "FPhone":"电话"
//                    "FMobilePhone":"移动电话"
//                    "FFax":"传真"
//                    "FEmail":"邮件地址"
//                    "FBank":"开户银行"
//                    "FAccount":"银行账号"
//                    "Fcorperate":"法人代表"
//                    "FDiscount":"折扣"
//                    "FTypeID":"供应商分类"
//                    "FTypeID_FName":"供应商分类"


//    {
//        "FRECORDS": 1,
//            "FItemId": 11944,
//            "FNumber": "7O.057",
//            "FName": "无锡一茶心企业服务有限公司",
//            "FParentId": 388,
//            "FHelpCode": "WXYCXQYFWYXGS",
//            "FShortName": null,
//            "FAddress": null,
//            "FStatus": 1072,
//            "FStatus_FName": "使用",
//            "FContact": null,
//            "FPhone": null,
//            "FMobilePhone": null,
//            "FFax": null,
//            "FEmail": null,
//            "FBank": "农行无锡江海支行",
//            "FAccount": "10631101040022371",
//            "Fcorperate": null,
//            "FDiscount": 0.0000000000,
//            "FTypeID": 0,
//            "FTypeID_FName": null
//    }
public static SysSupplier voToPo(KisSupplierDto vo) {
    if (vo == null) {
        return null;
    }
    SysSupplier sysSupplier = new SysSupplier();
    sysSupplier.setId(new Integer(vo.getFItemId()));
    sysSupplier.setSupplierCode(vo.getFNumber());
    sysSupplier.setSupplierName(vo.getFName());
    // todo 需要将金蝶类型存储在字典表中 或者转为系统相应的字典数据id
//        sysSupplier.setType(vo.getFTypeID());
    sysSupplier.setPhone(vo.getFMobilePhone());
    sysSupplier.setAddress(vo.getFAddress());
    sysSupplier.setBank(vo.getFBank());
    sysSupplier.setAccount(vo.getFAccount());
    sysSupplier.setAuditStatus(1);
    sysSupplier.setSupplierStatus(1);
    sysSupplier.setAuditId(TokenUtil.getUserId());
    sysSupplier.setDoDelete(0);
    return sysSupplier;
}
}
